<template>
  <div>
    <PageTools>
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="区域搜索">
          <el-input
            v-model="formInline.name"
            placeholder="请输入"
            clearable
          />
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            @click="Search"
          >查询</el-button>
        </el-form-item>
      </el-form>
    </PageTools>
    <el-card class="main">
      <el-button
        style="margin-bottom: 10px"
        type="primary"
        size="small"
        icon="el-icon-circle-plus-outline"
        @click="addForm"
      >新建</el-button>
      <!-- 表格 -->
      <el-table
        v-loading="loading"
        :data="list"
        style="width: 100%"
        :header-cell-style="{
          fontWeight: 'normal',
          background: '#f3f6fb',
        }"
      >
        <el-table-column type="index" label="序号" width="80" />
        <el-table-column label="工单编号" prop="taskCode" name="taskCode" />
        <el-table-column label="设备编号" prop="innerCode" name="innerCode" />
        <el-table-column label="工单类型" prop="taskType.typeName" />
        <el-table-column
          label="工单方式"
          prop="createType"
        />
        <el-table-column
          label="工单状态"
          prop="taskStatusTypeEntity.statusName"
        />
        <el-table-column label="运营人员" prop="userName" />
        <el-table-column
          label="创建日期"
          prop="updateTime"
          width="170"
        />
        <el-table-column label="操作">
          <template slot-scope="{ row }">
            <el-button
              type="text"
              size="small"
              @click="detailsFn(row)"
            >查看详情</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <el-row type="flex" justify="space-between" align="middle">
        <el-col :span="19">
          <p class="paginationHeader">
            {{
              `共${totalCount}条记录 第${page.pageIndex}/${totalPage}页`
            }}
          </p>
        </el-col>
        <el-col :span="5">
          <el-pagination
            background
            :current-page="page.pageIndex"
            :page-size="page.pageSize"
            :total="totalCount"
            layout="prev, next"
            prev-text="上一页"
            next-text="下一页"
            @current-change="changePage"
          />
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      formInline: { name: '' },
      loading: false,
      list: [],
      page: {
        pageIndex: 1,
        pageSize: 10
      },
      totalCount: 0,
      totalPage: 0
    }
  },
  methods: {
    // 1.查询
    Search() {},
    // 2.新增
    addForm() {},
    // 3.分页
    changePage(val) {
      this.page.pageIndex = val
    },
    // 4.查看详情
    detailsFn() {}
  }
}
</script>

<style lang="scss">
 @import "~@/styles/mainTop.scss";
 @import "~@/styles/mainAdd.scss";
 @import "~@/styles/mainTable.scss";
</style>
